<script>
	export default {
		onLaunch: function() {
			this.getCode();
		},
		onShow: function() {},
		onHide: function() {},
		methods: {
			async getCode() {
				uni.login({
					provider: 'weixin',
					success: (logins) => {
						this.$store.commit("storeWeixincode", logins.code);
						this.getOpenids(logins.code);
					},
				});
			},
			// 获取OPenid
			async getOpenids(codes) {
				let res = await this.$myrequest({
					url: `User/getCode?code=${codes}&type=2`
				});
				this.$store.commit("storeOpenid", res.data.data);
			}
		},
	}
</script>
<style>
	/* 官方css库 */
	@import "./common/uni.css";
	/* 自定图标库 */
	@import "./common/icon.css";
	/* 动画库 */
	@import "./common/animate.css";
</style>
